package cn.jbooter.coder.model;

import java.util.ArrayList;
import java.util.List;

import com.beust.jcommander.Parameter;

import cn.jbooter.coder.helper.CmdHelper.CommaParameterSplitter;

/**
 * 命令行参数
 * 
 * @author hejian
 *
 */
public class CmdLine {

	// ##### 参数定义区域 START ##########################
	// 这些参数是否来自命令行输入
	private boolean cmd = false;
	
	/** jdbc驱动 **/
	private String driver;
	
	/** 数据库类型: oracle,mysql **/
	private String dbType;
	
	/** 显示帮助 **/ 
	@Parameter(names = {"-h","--help"}, help = true,description="使用说明.")
	private boolean help;
	
	/** jdbc数据连接url(仅支持oracle和mysql) **/
	@Parameter(names = { "-l", "--url" }, required = true, description = "jdbc数据库连接url,当前仅支持oracle和mysql.")
	private String url;

	/** jdbc数据库连接用户 **/
	@Parameter(names = { "-u", "--username" }, required = true, description = "jdbc数据库连接用户.")
	private String username;

	/** jdbc数据库连接密码 **/
	@Parameter(names = { "-p", "--password" }, required = true, description = "jdbc数据库连接密码.")
	private String password;

	/** 代码最终生成路径 **/
	@Parameter(names = { "-o", "--output" }, required = true, description = "代码最终生成路径.")
	private String output;

	/** 包的前缀部分(eg:com.project) **/
	@Parameter(names = { "-f", "--prepackage" }, required = true, description = "java包前缀部分(eg:com.project).")
	private String prepackage;

	/** 子包部分(用于子模块包定义:eg:system.manage) **/
	@Parameter(names = { "-s", "--subpackage" }, required = false, description = "java子包部分,用于子模块包定义(eg:system.manage).")
	private String subpackage;

	/** 需要生成的层,多个用,号隔开(service,dao,dubbo) **/
	@Parameter(names = { "-m", "--layers" },splitter=CommaParameterSplitter.class, required = true, description = "要生成的代码层,多个用逗号隔开(eg:-m service,dao,dubbo).")
	private List<String> layers = new ArrayList<>();

	/** 需要将哪些表生成,多个用,号隔开 **/
	@Parameter(names = { "-t", "--tables" },splitter=CommaParameterSplitter.class, required = true, description = "指定要生成的表,多个用,号隔开(eg:-t table_01,table_02)")
	private List<String> tables=new ArrayList<>();
	// ##### 参数定义区域 END

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getOutput() {
		return output;
	}

	public void setOutput(String output) {
		this.output = output;
	}

	public String getPrepackage() {
		return prepackage;
	}

	public void setPrepackage(String prepackage) {
		this.prepackage = prepackage;
	}

	public String getSubpackage() {
		return subpackage;
	}

	public void setSubpackage(String subpackage) {
		this.subpackage = subpackage;
	}

	public List<String> getLayers() {
		return layers;
	}

	public void setLayers(List<String> layers) {
		this.layers = layers;
	}

	public List<String> getTables() {
		return tables;
	}

	public void setTables(List<String> tables) {
		this.tables = tables;
	}

	public boolean isCmd() {
		return cmd;
	}

	public void setCmd(boolean cmd) {
		this.cmd = cmd;
	}

	public boolean isHelp() {
		return help;
	}

	public void setHelp(boolean help) {
		this.help = help;
	}

	public String getDriver() {
		return driver;
	}

	public void setDriver(String driver) {
		this.driver = driver;
	}

	public String getDbType() {
		return dbType;
	}

	public void setDbType(String dbType) {
		this.dbType = dbType;
	}
	
}
